Standard Definitions
Standard definitions are standards that serve as enumerations. You can define a Standard definition for an objet or variable where it may be represented as a single value. For instance, colors are often turned into enumerations.
color: CLR {
def red "RED"
def orange "ORANGE"
def yellow "YELLOW"
def green "GREEN"
def blue "BLUE"
def indigo "INDIGO"
def violet "VIOLET"
}
Standard definitions are used by referencing them as a constraint in another standard. A standard representing a vehicle may have the color standard definition to define the vehicle color like so.
vehicle: VHL {
private vin string VN *
protected make string MK *
protected model string MDL *
protected type standard @CLR clr
}
Now when a value is passed to the vehicle standard for the color constraint, it must match one of the values define in the color standard definition.
Creating with Definitions
When using a create query and standard definitions, you can use the values verbatum or reference the standard. You reference standard definitions in any type of query like this:
#Create red vehicles
[vehicle] + ("VIN123", "Dodge", "Durango", red)
[vehicle] + ("VIN123", "Dodge", "Durango", "RED")
[vehicle] + ("VIN123", "Dodge", "Durango", @CLR.red)
#Delete red vehicles
[vehicle] - <color @CLR.red>
[vehicle] - <color "RED">
[vehicle] - <color red>
#Find 5 red vehicles
[vehicle] <color @CLR.red, LIMIT 5>